/*
 * Copyright @ 2025 weili23
 * com.example.ai.controller 16:27
 * All right reserved.
 */

package com.example.ai.controller;

import com.example.ai.assistant.ZhiyiAssistant;
import com.example.ai.entity.dto.ZhiyiDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @desc: 智医助手controller
 * @author: weili23
 * @createTime: 2025/4/30 16:27
 * @version: v1.0
 */
@Tag(name = "智医助手")
@RestController
@RequestMapping(value = "/xiaozhi")
public class ZhiyiController {
    @Autowired
    private ZhiyiAssistant zhiyiAssistant;
    @Operation(summary = "智医助手对话")
    @PostMapping(value = "/chat",produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestBody ZhiyiDto zhiyiDto) {
        Flux<String> chat = zhiyiAssistant.chat(zhiyiDto.getMemoryId(), zhiyiDto.getMessage());
        return chat;
    }
}
